<select>
	<?php # get cabang from session
		foreach($cabang as $row) { ?>
			<option value='<?=$row['kode_cabang']?>'> <?=$row['nama_cabang']?> </option>
		<?php }
	?>
</select>
<select>
	<?php # get harga from session
		foreach($harga as $row) { ?>
			<option value='<?=$row['kode_harga']?>'> <?=$row['kode_harga']?> </option>
		<?php }
	?>
</select>
<select>
	<?php # get all unit from table unit in database
		foreach($unit as $row) { ?>
			<option value='<?=$row -> kode_unit?>'> <?=$row -> nama_unit?> </option>
		<?php }
	?>
</select>

<?php # this code will create an array filled with distinct value from result
	$temp_kode = ""; $temp_nama = ""; $array = array();
	foreach ($result as $row) {
		if($row -> kode_barang != $temp_kode || $row -> nama_barang != $temp_nama) {
			$temp_array = array(
				'kode_barang' => $row -> kode_barang,
				'nama_barang' => $row -> nama_barang
			);
			array_push($array, $temp_array);
			$temp_kode = $row -> kode_barang;
			$temp_nama = $row -> nama_barang;
		}
	}
?>
<select>
	<?php foreach($array as $row) { ?>
		<option value='<?=$row['kode_barang']?>'> <?=$row['nama_barang']?> </option>
	<?php } ?>
</select>